<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/xhtml;charset=utf-8" http-equiv="Content-Type"/>
<meta content="IE=9" http-equiv="X-UA-Compatible"/>
<meta content="Doxygen 1.8.13" name="generator"/>
<title>OpenCV: OpenGL support</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script src="../../jquery.js" type="text/javascript"></script>
<script src="../../dynsections.js" type="text/javascript"></script>
<script src="../../tutorial-utils.js" type="text/javascript"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script src="../../search/searchdata.js" type="text/javascript"></script>
<script src="../../search/search.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js" type="text/javascript"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellpadding="0" cellspacing="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
    <span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script src="../../menudata.js" type="text/javascript"></script>
<script src="../../menu.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow" onkeydown="return searchBox.OnSearchSelectKey(event)" onmouseout="return searchBox.OnSearchSelectHide()" onmouseover="return searchBox.OnSearchSelectShow()">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe frameborder="0" id="MSearchResults" name="MSearchResults" src="javascript:void(0)">
</iframe>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">OpenGL support<div class="ingroups"><a class="el" href="../../d7/dfc/group__highgui.html">High-level GUI</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaae7e90aa3415c68dba22a5ff2cefc25d"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d24/group__highgui__opengl.html#gaae7e90aa3415c68dba22a5ff2cefc25d">cv::imshow</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;winname, const <a class="el" href="../../d5/ddf/classcv_1_1ogl_1_1Texture2D.html">ogl::Texture2D</a> &amp;tex)</td></tr>
<tr class="memdesc:gaae7e90aa3415c68dba22a5ff2cefc25d"><td class="mdescLeft"> </td><td class="mdescRight">Displays OpenGL 2D texture in the specified window.  <a href="../../df/d24/group__highgui__opengl.html#gaae7e90aa3415c68dba22a5ff2cefc25d">More...</a><br/></td></tr>
<tr class="separator:gaae7e90aa3415c68dba22a5ff2cefc25d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1168ad91e634e3e34e2295a3ba9a6244"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d24/group__highgui__opengl.html#ga1168ad91e634e3e34e2295a3ba9a6244">cv::setOpenGlContext</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;winname)</td></tr>
<tr class="memdesc:ga1168ad91e634e3e34e2295a3ba9a6244"><td class="mdescLeft"> </td><td class="mdescRight">Sets the specified window as current OpenGL context.  <a href="../../df/d24/group__highgui__opengl.html#ga1168ad91e634e3e34e2295a3ba9a6244">More...</a><br/></td></tr>
<tr class="separator:ga1168ad91e634e3e34e2295a3ba9a6244"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf80dcbc168a6ce40f6d1ad9d79a10bb8"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d24/group__highgui__opengl.html#gaf80dcbc168a6ce40f6d1ad9d79a10bb8">cv::setOpenGlDrawCallback</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;winname, <a class="el" href="../../d7/dfc/group__highgui.html#ga8bed4feb08f866e81514a31fdacaceee">OpenGlDrawCallback</a> onOpenGlDraw, void *userdata=0)</td></tr>
<tr class="memdesc:gaf80dcbc168a6ce40f6d1ad9d79a10bb8"><td class="mdescLeft"> </td><td class="mdescRight">Sets a callback function to be called to draw on top of displayed image.  <a href="../../df/d24/group__highgui__opengl.html#gaf80dcbc168a6ce40f6d1ad9d79a10bb8">More...</a><br/></td></tr>
<tr class="separator:gaf80dcbc168a6ce40f6d1ad9d79a10bb8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga21b41f9217e40eb64eed79b4cecf595d"><td align="right" class="memItemLeft" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d24/group__highgui__opengl.html#ga21b41f9217e40eb64eed79b4cecf595d">cv::updateWindow</a> (const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp;winname)</td></tr>
<tr class="memdesc:ga21b41f9217e40eb64eed79b4cecf595d"><td class="mdescLeft"> </td><td class="mdescRight">Force window to redraw its context and call draw callback ( See <a class="el" href="../../df/d24/group__highgui__opengl.html#gaf80dcbc168a6ce40f6d1ad9d79a10bb8" title="Sets a callback function to be called to draw on top of displayed image. ">cv::setOpenGlDrawCallback</a> ).  <a href="../../df/d24/group__highgui__opengl.html#ga21b41f9217e40eb64eed79b4cecf595d">More...</a><br/></td></tr>
<tr class="separator:ga21b41f9217e40eb64eed79b4cecf595d"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a id="details" name="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaae7e90aa3415c68dba22a5ff2cefc25d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaae7e90aa3415c68dba22a5ff2cefc25d">◆ </a></span>imshow()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::imshow </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>winname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="../../d5/ddf/classcv_1_1ogl_1_1Texture2D.html">ogl::Texture2D</a> &amp; </td>
          <td class="paramname"><em>tex</em> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table><table class="python_language"><tr><th colspan="999" style="text-align:left">Python:</th></tr><tr><td style="width: 20px;"></td><td>None</td><td>=</td><td>cv.imshow(</td><td class="paramname">winname, mat</td><td>)</td></tr></table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d4/dd5/highgui_8hpp.html">opencv2/highgui.hpp</a>&gt;</code></p>
<p>Displays OpenGL 2D texture in the specified window. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">winname</td><td>Name of the window. </td></tr>
    <tr><td class="paramname">tex</td><td>OpenGL 2D texture data. </td></tr>
  </table>
  </dd>
</dl>
</div>
</div>
<a id="ga1168ad91e634e3e34e2295a3ba9a6244"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1168ad91e634e3e34e2295a3ba9a6244">◆ </a></span>setOpenGlContext()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::setOpenGlContext </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>winname</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d4/dd5/highgui_8hpp.html">opencv2/highgui.hpp</a>&gt;</code></p>
<p>Sets the specified window as current OpenGL context. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">winname</td><td>Name of the window. </td></tr>
  </table>
  </dd>
</dl>
</div>
</div>
<a id="gaf80dcbc168a6ce40f6d1ad9d79a10bb8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf80dcbc168a6ce40f6d1ad9d79a10bb8">◆ </a></span>setOpenGlDrawCallback()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::setOpenGlDrawCallback </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>winname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../d7/dfc/group__highgui.html#ga8bed4feb08f866e81514a31fdacaceee">OpenGlDrawCallback</a> </td>
          <td class="paramname"><em>onOpenGlDraw</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void * </td>
          <td class="paramname"><em>userdata</em> = <code>0</code> </td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d4/dd5/highgui_8hpp.html">opencv2/highgui.hpp</a>&gt;</code></p>
<p>Sets a callback function to be called to draw on top of displayed image. </p>
<p>The function setOpenGlDrawCallback can be used to draw 3D data on the window. See the example of callback function below: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> on_opengl(<span class="keywordtype">void</span>* param)</div><div class="line">{</div><div class="line">    glLoadIdentity();</div><div class="line"></div><div class="line">    glTranslated(0.0, 0.0, -1.0);</div><div class="line"></div><div class="line">    glRotatef( 55, 1, 0, 0 );</div><div class="line">    glRotatef( 45, 0, 1, 0 );</div><div class="line">    glRotatef( 0, 0, 0, 1 );</div><div class="line"></div><div class="line">    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> coords[6][4][3] = {</div><div class="line">        { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },</div><div class="line">        { { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },</div><div class="line">        { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },</div><div class="line">        { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },</div><div class="line">        { { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },</div><div class="line">        { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 6; ++i) {</div><div class="line">                glColor3ub( i*20, 100+i*10, i*42 );</div><div class="line">                glBegin(GL_QUADS);</div><div class="line">                <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; 4; ++j) {</div><div class="line">                        glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1], 0.2 * coords[i][j][2]);</div><div class="line">                }</div><div class="line">                glEnd();</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">winname</td><td>Name of the window. </td></tr>
    <tr><td class="paramname">onOpenGlDraw</td><td>Pointer to the function to be called every frame. This function should be prototyped as void Foo(void*) . </td></tr>
    <tr><td class="paramname">userdata</td><td>Pointer passed to the callback function.(<b>Optional</b>) </td></tr>
  </table>
  </dd>
</dl>
</div>
</div>
<a id="ga21b41f9217e40eb64eed79b4cecf595d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga21b41f9217e40eb64eed79b4cecf595d">◆ </a></span>updateWindow()</h2>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cv::updateWindow </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="../../dc/d84/group__core__basic.html#ga1f6634802eeadfd7245bc75cf3e216c2">String</a> &amp; </td>
          <td class="paramname"><em>winname</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p><code>#include &lt;<a class="el" href="../../d4/dd5/highgui_8hpp.html">opencv2/highgui.hpp</a>&gt;</code></p>
<p>Force window to redraw its context and call draw callback ( See <a class="el" href="../../df/d24/group__highgui__opengl.html#gaf80dcbc168a6ce40f6d1ad9d79a10bb8" title="Sets a callback function to be called to draw on top of displayed image. ">cv::setOpenGlDrawCallback</a> ). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">winname</td><td>Name of the window. </td></tr>
  </table>
  </dd>
</dl>
</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:40 for OpenCV by  <a href="http://www.doxygen.org/index.html">
<img alt="doxygen" class="footer" src="../../doxygen.png"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
